module UsersHelper
  def button_friendship(user)
    friendship = current_user.friendship_for(user)
    if friendship.nil?
      button_to 'Add friend',
        { :action => :create,
        :controller => :friendships,
        :friend_id => user.id },
        :method => :post,
        :remote => true ,
        :class => 'btn btn-mini btn-success'

    elsif friendship.status == 'requested'
      raw "<span class=\"label label-warning\">Invited</span> "
    elsif friendship.status == 'pending'
      raw "<span class=\"label label-important\">Pending</span> "
    else
      raw "<span class=\"label label-info\">Friends</span> "
    end
  end
end
